import init_env_impl
import json
import requests


def test_google_search(query):
    url = "https://google.serper.dev/search"
    payload = json.dumps({
        "q": query
    })
    headers = {
        'X-API-KEY': init_env_impl.get_evn_key("GOOGLE_API_KEY"),
        'Content-Type': init_env_impl.get_evn_key("GOOGLE_API_RES_TYPE")
    }
    response = requests.request("POST", url, headers=headers, data=payload)
    print(response.text)


if __name__ == "__main__":
    query = "中国五一假期放假几天"
    test_google_search(query=query)
